{php include wl_template('common/header');}
<div class="page-group">
    <div class="page page-current" id="page-coupon-list">
    	<header class="bar bar-nav">
		    <a class="button button-link button-nav pull-left back" href="{php echo app_url('member/home')}">
		      <span class="icon icon-left"></span>返回
		    </a>
		    <h1 class="title">我的活动记录</h1>
		    {if !empty($scratch)}
		    <a class="button button-link button-nav pull-right back" href="{php echo app_url('pay/success/activity');}">
		      <span class="icon icon-right"></span>去抽奖
		    </a>
		    {/if}
		</header>
		<div class="content native-scroll">
		    <div class="buttons-tab">
		      <a href="#tab1" class="tab-link button active">已领取</a>
		      <a href="#tab2" class="tab-link button">未领取</a>
		    </div>
		    <div class="tabs">
		      <div id="tab1" class="tab active">
		      </div>
		      <div id="tab2" class="tab">
		      </div>
		    </div>
		</div>
	</div>
</div>
<script type="text/html" id="couponlist">
{{# for(var i = 0, len = d.length; i < len; i++){ }}
<div class="card" style="border-radius: .2rem;">
  <div class="card-content" style="border-radius: .2rem .2rem 0 0;color: white;{{# if(i%3 == 0){ }}background-color: #4dd6b1;{{# }else if(i%3 == 1){ }}background-color: #6eb3e8;{{# }else{ }}background-color: #ffb600;{{# } }}">
    <div class="list-block media-list">
      <ul>
        <li class="item-content">
          <div class="item-media">
            <img src="{php echo tomedia($config['tginfo']['slogo'])}" width="50" style="border-radius: 25px;">
          </div>
          <div class="item-inner">
            <div class="item-title-row">
              <div class="item-title">{{ d[i].name }}</div>
            </div>
            <div class="item-subtitle">奖品：{{ d[i].prize }}</div>
          </div>
        </li>
      </ul>
    </div>
  </div>
  <div class="card-footer">
    <span>参与时间：{{ d[i].createtime }}</span>
  </div>
</div>
{{# } }}
</script>
<script>
$(function () {
  'use strict';
	$(document).on("pageInit", "#page-coupon-list", function(e, id, page) {
		var gettpl = document.getElementById('couponlist').innerHTML;
		var emphtml = '<div class="m-cart" id="s"><div class="empty" id="pro-view-6">暂无优惠券，<a href="{php echo app_url('goods/index')}" class="external">马上去逛逛~</a></div></div>';
		laytpl(gettpl).render({php echo json_encode($data)}, function(html){
			if(html.length < 10){
				$("#tab1").append(emphtml);
			}else{
				$("#tab1").append(html);
			}
		});
		laytpl(gettpl).render({php echo json_encode($coupon1)}, function(html){
			if(html.length < 10){
				$("#tab2").append(emphtml);
			}else{
				$("#tab2").append(html);
			}
		});
		laytpl(gettpl).render({php echo json_encode($coupon2)}, function(html){
			if(html.length < 10){
				$("#tab3").append(emphtml);
			}else{
				$("#tab3").append(html);
			}
		});
	});
  $.init();
});
</script>
{php include wl_template('common/footer');}